package com.demo.component;

import com.demo.model.Student;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
public class StudentBeans {
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
//    @Scope("prototype")
    @Bean
    public Student student1(){
        Student student=new Student();
        student.setId(1);
        student.setName("张三");
        return student;
    }
//    @Bean
//    public Student student2(){
//        Student student=new Student();
//        student.setId(2);
//        student.setName("李四");
//        return student;
//    }
}
